import {
  collectionListApi,
  feedbackApi,
  oneClickLoginApi,
  publishListApi,
  queryUserInfoApi,
  updateInfoApi,
} from '../api/userInfo';

// 更新用户信息
export const updateInfoFun = (data: any) => {
  return new Promise((reslve: any, reject: any) => {
    updateInfoApi(data)
      .then((res: any) => {
        if(res.code==='0'){
          reslve(res.data);
        }else{
          reslve(res);
        }
      })
      .catch((e: any) => {
        reject(e);
      });
  });
};

// 用户详情
export const queryUserInfoFun = (data: any) => {
  return new Promise((reslve: any, reject: any) => {
    queryUserInfoApi(data)
      .then((res: any) => {
        reslve(res.data);
      })
      .catch((e: any) => {
        reject(e);
      });
  });
};

// 我的收藏
export const collectionListFun = (data: any) => {
  return new Promise((reslve: any, reject: any) => {
    collectionListApi(data)
      .then((res: any) => {
        reslve(res.data);
      })
      .catch((e: any) => {
        reject(e);
      });
  });
};

// 我的发布
export const publishListFun = (data: any) => {
  return new Promise((reslve: any, reject: any) => {
    publishListApi(data)
      .then((res: any) => {
        reslve(res.data);
      })
      .catch((e: any) => {
        reject(e);
      });
  });
};

// 意见反馈
export const feedbackFun = (data: any) => {
  return new Promise((reslve: any, reject: any) => {
    feedbackApi(data)
      .then((res: any) => {
        reslve(res.data);
      })
      .catch((e: any) => {
        reject(e);
      });
  });
};

// 一键登录
export const oneClickLoginFun = (data: any) => {
  return new Promise((reslve: any, reject: any) => {
    oneClickLoginApi(data)
      .then((res: any) => {
        reslve(res);
      })
      .catch((e: any) => {
        reject(e);
      });
  });
};
